<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/help.css" rel="stylesheet" type="text/css"/>
</block>

<block name="body">
    <div class="col-md-12">
        <include file="Public/user_info"/>
        <include file="Public/_top_menu"/>
    </div>

    <div class="col-md-12 ">
        <div class="bgwhite pull-left" style="min-height: 600px;padding-bottom: 50px;margin-top: 0">
            <div class="help_h" style="">
                <a href="#" class="pull-left active" style="width: 120px;">帮忙描述</a>
                <a  href="{:U('help/index/evaluate',array('id'=>$help['id']))}" class="pull-left" style="width: 120px;">帮忙评价</a>
                <a href="{:U('help/index/production',array('id'=>$help['id']))}" class="pull-left"
                   style="width: 120px;">帮忙作品</a>
            </div>
            <div class=" col-xs-12" style="padding-left: 10px;padding-right: 10px;">
                <div class="help_detail" style="">
                    <div class="col-ten-2 col-xs-6" style="">
                        <img src="{:getThumbImageById($help['cover_id'],168,168)}" style="margin-top: 11px;" class=""/>
                    </div>
                    <div class="col-ten-2 col-xs-6 pull-right  " style="border-left: 1px solid #ccc;height: 190px;">
                        <div class="vertical_middle" style="height: 190px;">
                            <p>
                                <a class="author " href="{$help.user.space_url}" ucard="{$help.user.uid}">
                                    {$help.user.nickname} </a>
                            </p>

                            <p>
                                发布于{:date('Y年m月d日',$help['create_time'])}
                            </p>

                            <div>
                                <if condition="check_can_edit($id)">
                                    <a href="{:U('help/index/ask',array('id'=>$id))}">编辑</a>
                                </if>
                            </div>

                        </div>
                    </div>
                    <div class="col-ten-6 col-xs-12  help_detail_info">
                        <div class="" style="margin-bottom: 15px;">
                            <p class="help_detail_title">{$help.title}</p>

                            <div class="dashed"></div>
                        </div>
                        <div class="pull-left div"><span class="help_detail_label"
                                                         style="margin-left: 0">地区：</span><span
                                class="help_detail_content">{:get_area($help['province'],$help['city'],$help['district'])}</span>
                        </div>
                        <div class="pull-left div"><span class="help_detail_label">类型：</span><span
                                class="help_detail_content">{:get_type($help['type'])}</span></div>
                        <php>
                            if($help['type']<=7&&$help['type']>0){
                        </php>
                        <div class="pull-left div"><span class="help_detail_label">性别：</span><span
                                class="help_detail_content">{:get_sex($help['sex'])}</span></div>
                        <div class="pull-left div"><span class="help_detail_label">年龄：</span><span
                                class="help_detail_content">{$help['s_age']}-{$help['e_age']}</span></div>
                        <php>
                            if($help['type']<=4){
                        </php>
                        <div class="pull-left div"><span class="help_detail_label">身高：</span><span
                                class="help_detail_content">{$help['s_height']}-{$help['e_height']}</span></div>
                        <php>
                            }
                            }
                        </php>
                        <div class="pull-left div"><span class="help_detail_label">开始时间：</span><span
                                class="help_detail_content">{:date('Y-m-d H:i:s',$help['s_time'])}  </span></div>
                        <div class="pull-left div"><span class="help_detail_label">结束时间：</span><span
                                class="help_detail_content">{:date('Y-m-d H:i:s',$help['e_time'])} </span></div>
                        <php>
                            if($help['type']<=7&&$help['type']>0){
                        </php>
                        <div class="pull-left div"><span class="help_detail_label">人数：</span><span
                                class="help_detail_content">{$help['number']}人</span></div>
                        <php>
                            }
                        </php>
                    </div>
                </div>

                <div class="help_detail_description" style="margin:20px 10px">
                    <div style="font-size: 20px;color: #000;margin: 20px 0 10px 0;">参考素材：</div>
                    <div class="help_detail_content">
                        {$help['description']}
                    </div>

                </div>
                <div style="margin:0px 10px">
                <div class="dashed"></div>
                    </div>
                <div class="col-xs-12" style="text-align: center;margin:65px 0">
                    <button class="btn btn-large btn-primary button_change" id="sign_attend_help"
                            href="{:U('help/index/signattend',array('help_id'=>$help['id']))}">
                            <span id="submit-content" style="font-size: 20px;">
                                    我要帮忙
                            </span>
                    </button>

                </div>
                <div style="margin:0px 10px">
                <div class="clearfix dashed" style=""></div>
                    </div>
                <div class="" style="margin:0px 10px;margin-bottom: 20px;">
                    <h5 style="font-size: 16px;color: #000">报名帮忙的人</h5>

                    <div>
                        <php>if(!$hidden_count && !$sign_list){</php>

                        <div class="row">
                            <div class="col-xs-12">
                                <p class="text-muted" style="text-align: center; font-size: 3em;">
                                    暂时没有人报名帮忙～
                                    <br/>
                                </p>
                            </div>
                        </div>
                        <php>}</php>
                        <if condition="$hidden_count">
                            <div class="vertical_middle help_sign_hide" style="width: 105px">
                                <p style="margin-top: 22px">{$hidden_count}人</p>

                                <p> 隐藏了报名</p>
                            </div>
                        </if>

                        <volist name="sign_list" id="list">

                            <div class="vertical_middle help_sign">
                                <a class="author " href="{$list.user.space_url}" style="color: #f36119">
                                    <img src="{$list.user.avatar128}" style="width: 98px;height: 98px;"
                                         class="pull-left"/>
                                </a>

                                <div class="pull-left" style="width: 125px;">
                                    <div class="help_sign_username"><a class="author text-more" href="{$list.user.space_url}"
                                                                       ucard="{$list.user.uid}" style="color: #f36119;width: 100%">
                                        {$list.user.nickname} </a></div>
                                    <div class="text-more" style="width: 100%"><attr title="{$list.user.address|default='未填写地区'}">{$list.user.address|default="未填写地区"}</attr></div>
                                    <div class="text-more" style="width: 100%"><attr title="{$list.user.doing|default='未填写职业'}">{$list.user.doing|default="未填写职业"}</attr></div>
                                    <div> 膜拜 <span class="count">{$list.user.fans}</span> 帮忙<span class="count"> {$list.user.help_count}</span>
                                    </div>

                                </div>
                                <if condition="$help['user']['uid'] eq is_login()">
                                <div class="text-center accept_btn_div">
                                    <a class="btn btn-primary btn-sm accept_btn button_change"
                                       data-url="{:U('help/index/acceptSomeone')}" data-id="{$list.id}">接受帮忙</a>
                                </div>
                                </if>
                                <if condition="$list['user']['uid'] eq is_login()">
                                    <div class="text-center accept_btn_div">
                                        <a class="btn btn-primary btn-sm accept_btn button_change"
                                           data-url="{:U('help/index/stopSignAttend',array('help_id'=>$help['id']))}" data-id="{$list.id}">取消报名</a>
                                    </div>
                                </if>
                            </div>

                        </volist>

                    </div>
                </div>
                <php>if($accept_list){</php>
                <div style="margin:0px 10px">
                <div class="clearfix dashed" style=""></div>
                    </div>
                <div class="" style="margin:0px 10px">
                    <h5 style="font-size: 16px;color: #000">接受帮忙的人</h5>

                    <div>

                        <volist name="accept_list" id="list_accept">
                            <div class="vertical_middle help_sign">
                                <a class="author " href="{$list_accept.user.space_url}" style="color: #f36119">
                                    <img src="{$list_accept.user.avatar128}" style="width: 98px;height: 98px;"
                                         class="pull-left"/>
                                </a>

                                <div class="pull-left" style="width: 125px;">
                                    <div class="help_sign_username"><a class="author text-more"
                                                                       href="{$list_accept.user.space_url}"
                                                                       ucard="{$list_accept.user.uid}"
                                                                       style="color: #f36119;width: 100%">
                                        {$list_accept.user.nickname} </a></div>
                                    <div class="text-more" style="width: 100%"><attr title="{$list_accept.user.address|default='未填写地区'}">{$list_accept.user.address|default="未填写地区"}</attr></div>
                                    <div class="text-more" style="width: 100%"><attr title="{$list_accept.user.doing|default='未填写职业'}">{$list_accept.user.doing|default="未填写职业"}</attr></div>
                                    <div> 膜拜 <span class="count">{$list_accept.user.fans}</span> 帮忙<span class="count"> {$list_accept.user.help_count}</span>
                                    </div>
                                </div>
                                <if condition="($help['user']['uid'] eq is_login())||($list_accept['user']['uid'] eq is_login())">
                                <div class="text-center accept_btn_div">
                                    <p>手机：{$list_accept.phone}</p>

                                    <p>电话：{$list_accept.telephone}</p>

                                    <p>QQ：{$list_accept.qq}</p>

                                    <p>微信：{$list_accept.weixin}</p>
                                    <if condition="$help['user']['uid'] eq is_login()">
                                    <a class="btn btn-primary btn-sm cancel_accept_btn button_change"
                                       data-url="{:U('help/index/cancelAccept')}" data-id="{$list_accept.id}">取消接受</a>
                                    </if>
                                </div>
                                </if>
                            </div>
                        </volist>

                    </div>
                </div>

                <php>}</php>
            </div>

        </div>
    </div>
    <style>
        .text-more{
            white-space: nowrap!important;
        }
    </style>
    <script>
        $(function () {
            bindSignAttendHelp();

            $('.help_sign').mouseover(function () {
                var obj = $(this);
                obj.css('border-color', '#f58220')
                obj.find('.accept_btn_div').show()
            })

            $('.help_sign').mouseleave(function () {
                var obj = $(this);
                obj.css('border-color', '#eaeaea')
                obj.find('.accept_btn_div').hide()
            })

            $('.accept_btn').click(function () {
                var obj = $(this);
                var url = obj.attr('data-url');
                var id = obj.attr('data-id');
                $.post(url, {id: id}, function (res) {
                    handleAjax(res);
                }, 'json')
            })

            $('.cancel_accept_btn').click(function () {
                var obj = $(this);
                var url = obj.attr('data-url');
                var id = obj.attr('data-id');
                $.post(url, {id: id}, function (res) {
                    handleAjax(res);
                }, 'json')
            })
        });
        function bindSignAttendHelp() {
            $('#sign_attend_help').magnificPopup({
                type: 'ajax',
                overflowY: 'scroll',
                modal: true,
                callbacks: {
                }
            });
        }
    </script>

</block>

